<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>
    <style type="text/css">
        .blue {
            color:blue;
        }
    </style>
</head>
<body>

    <h1 class="blue">标题 1</h1>
    <h2 class="blue">标题 2</h2>
    <p class="blue">这是一个段落。</p>
    <p>这是另外一个段落。</p>
    <br>
    <button>切换 class</button>
    <script>
        $(function () {
            $('button').click(function () {
                $('h1,h2,p').toggleClass('blue')
            })
        })
    </script>

</body>
</html>